<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8" />
        <title>首页 - 默笙后台管理系统</title>
        <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
        <meta content="这不仅仅是一个后台管理系统，它基于BT4，超强的自适应，简洁，高效，大方" />
        <meta content="Mosheng" name="author" />


        <!-- App favicon -->
        <link rel="shortcut icon" href="{$Think.const.ADMIN_URL}/assets/images/favicon.ico">

        <!-- App css -->
        <link href="{$Think.const.ADMIN_URL}/css/vendor/sweetalert2.min.css" rel="stylesheet" type="text/css" />
        <link href="{$Think.const.ADMIN_URL}/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
        <link href="{$Think.const.ADMIN_URL}/css/icons.min.css" rel="stylesheet" type="text/css" />
        <link href="{$Think.const.ADMIN_URL}/css/app.min.css" rel="stylesheet" type="text/css" />

    </head>

    <body>

        <!-- 公共头部开始-->
        <include file="Common:header" />
        <!-- 公共头部结束-->

        <div class="wrapper">
            <div class="container-fluid">

                <!-- start page title -->
                <div class="row">
                    <div class="col-12">
                        <div class="page-title-box">
                            <div class="page-title-right">
                                <ol class="breadcrumb m-0">
                                    <li class="breadcrumb-item"><a href="#">默笙</a></li>
                                    <li class="breadcrumb-item active">仪表盘</li>
                                </ol>
                            </div>
                            <h4 class="page-title">仪表盘</h4>
                        </div>
                    </div>
                </div>     
                <!-- end page title --> 

                <div class="row">
                    <div class="col-xl-3 col-lg-6">
                        <div class="card widget-flat">
                            <div class="card-body p-0">
                                <div class="p-3 pb-0">
                                    <div class="float-right">
                                        <i class="mdi mdi-account-card-details text-primary widget-icon"></i>
                                    </div>
                                    <h5 class="text-muted font-weight-normal mt-0">密码总数</h5>
                                    <h3 class="mt-2">{$passcount}</h3>
                                </div>
                                <div id="sparkline1"></div>
                            </div> <!-- end card-body-->
                        </div> <!-- end card-->
                    </div> <!-- end col-->

                    <div class="col-xl-3 col-lg-6">
                        <div class="card widget-flat">
                            <div class="card-body p-0">
                                <div class="p-3 pb-0">
                                    <div class="float-right">
                                        <i class="mdi mdi-buffer text-danger widget-icon"></i>
                                    </div>
                                    <h5 class="text-muted font-weight-normal mt-0">分类总数</h5>
                                    <h3 class="mt-2">{$classcount}</h3>
                                </div>
                                <div id="sparkline2"></div>
                            </div> <!-- end card-body-->
                        </div> <!-- end card-->
                    </div> <!-- end col-->

                    <div class="col-xl-3 col-lg-6">
                        <div class="card widget-flat">
                            <div class="card-body p-0">
                                <div class="p-3 pb-0">
                                    <div class="float-right">
                                        <i class="mdi mdi-account-multiple text-primary widget-icon"></i>
                                    </div>
                                    <h5 class="text-muted font-weight-normal mt-0">用户总数</h5>
                                    <h3 class="mt-2">{$admincount}</h3>
                                </div>
                                <div id="sparkline3"></div>
                            </div> <!-- end card-body-->
                        </div> <!-- end card-->
                    </div> <!-- end col-->

                    <div class="col-xl-3 col-lg-6">
                        <div class="card widget-flat">
                            <div class="card-body p-0">
                                <div class="p-3 pb-0">
                                    <div class="float-right">
                                        <i class="mdi mdi-autorenew text-danger widget-icon"></i>
                                    </div>
                                    <h5 class="text-muted font-weight-normal mt-0">非法提交</h5>
                                    <h3 class="mt-2">{$visitcount}</h3>
                                </div>
                                <div id="sparkline4"></div>
                            </div> <!-- end card-body-->
                        </div> <!-- end card-->
                    </div> <!-- end col-->
                </div>
                <!-- end row -->

                <!-- 关闭图表显示 -->

                <!-- end row -->

                <div class="row">
                    <div class="col-12">
                        <div class="card">
                            <div class="card-body">
                                <h4 class="header-title">密码列表 只展示最新添加的近10条记录 温馨提示：点击蓝色字体可复制</h4>

                                <div class="table-responsive mt-3">
                                    <table class="table table-hover table-centered mb-0">
                                        <thead>
                                            <tr>
                                                <th>ID</th>
                                                <th>账户&备注</th>
                                                
                                                <th>密码</th>
                                                <th>登录网址</th>
                                                <th>操作</th>
                                            </tr>
                                        </thead>
                                    
                                    
                                        <tbody>
                                            <volist name="plist" id="p">
                                            <tr>
                                                <td><b>{$p.id}</b></td>
                                                <td>
                                                    <!-- <img src="assets/images/users/avatar-2.jpg" alt="contact-img" height="36" title="contact-img" class="rounded-circle float-left mr-2"> -->
                                                    <p class="mb-0 font-weight-bold">
                                                    <span value="{$p.username}" class="copyVideo" style="color:#10b7ff;cursor:pointer;" onclick="copyVideoUrl(event)">{$p.username}</span>
                                                    </p>
                                                    <span class="font-13">{$p.remark}</span>
                                                </td>
    
                                                
    
                                                <td>
                                                    <eq name="at.is_all" value="1">
                                                    <span class="badge badge-danger badge-pill">**********</span>
                                                    </eq>
                                                    <eq name="at.is_all" value="0">
                                                    
                                                    <span value="{$p.password}" class="copyVideo" style="color:#10b7ff;cursor:pointer;" onclick="copyVideoUrl(event)">{$p.password}</span>
                                                    
                                                    </eq>
                                                </td>
    
                                                <td>
                                                    <a href="//{$p.adress}">{$p.adress}</a>
                                                </td>
    
                                                <td>
                                                    <div class="btn-group dropdown">
                                                        <a href="javascript: void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown" aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
                                                        <div class="dropdown-menu dropdown-menu-right">
                                                           <eq name="at.is_all" value="0">
                                            <a class="btn btn-link" href="{:U('admin.php/pass/uppass',array('id'=>$p[id]))}" title="编辑"><i class="mdi mdi-pencil mr-1 text-muted"></i>编辑</a>
                                            <a class="btn btn-link" onClick="ty_del(this,'{$p.id}')" title="删除"><i class="mdi mdi-delete mr-1 text-muted"></i>删除</a>
                                            </eq>
                                            <eq name="at.is_all" value="1">
                                                    <span class="badge-pill">没有权限</span>
                                            </eq>
                                                           
                                                        </div>
                                                    </div>
                                                </td>
                                            </tr>
                                            </volist>
                                        </tbody>
                                    </table>
    
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <!-- end row -->

                
            </div> <!-- end container -->
        </div>
        <!-- end wrapper -->
        

        <!-- 公共底部开始-->
        <include file="Common:footer" />
        <!-- 公共底部结束-->


        <!-- App js -->
        <script src="{$Think.const.ADMIN_URL}/js/vendor.min.js"></script>
        <script src="{$Think.const.ADMIN_URL}/js/app.min.js"></script>
        
        <!-- Plugins js -->
        <script src="{$Think.const.ADMIN_URL}/js/vendor/sweetalert2.min.js"></script>
        <script src="{$Think.const.ADMIN_URL}/js/pages/sweet-alerts.init.js"></script>
       
        <script src="{$Think.const.ADMIN_URL}/js/vendor/jquery.sparkline.min.js"></script>
        <script src="{$Think.const.ADMIN_URL}/js/vendor/jquery.knob.min.js"></script>
		<script src="{$Think.const.ADMIN_URL}/layer/layer.js"></script>
        <script src="{$Think.const.ADMIN_URL}/js/pages/dashboard.init.js"></script>
        <script type="text/javascript">
           function copyVideoUrl(event){

            var value = $(event.target).closest("span").attr('value');
            var success;
            var $temp = $("<input>");
            $("body").append($temp);
            $temp.val(value).select();
            try{
               success = document.execCommand("copy");
            }catch (e){
                succeed = false;
            }
            if(success){
                swal({
                        title: "复制成功！",
                            text: "<?php echo($message); ?>",
                            type: "success",
                            confirmButtonClass: "btn btn-confirm mt-2"
                    })
            }

            $temp.remove();
        }
        function ty_del(obj, id) {
            var id = id;
            layer.confirm('确认要删除吗？', function (index) {

                $.ajax({
                    type: 'POST',
                    url: '{:U('admin.php/index/passdel')}',
                    dataType: 'json',
                    data: { id: id },
                    success: function (data) {
                        console.log(data);
                        if (data.status == '1') {
                            layer.msg(data.info);//layer.msg('不开心。。', {icon: 5});
                            window.location.reload();
                        } else {
                            layer.msg(data.info);
                        }
                    },
                    error: function (data) {
                        layer.msg('删除失败!');
                    },
                });
            });
        }
        </script>
    </body>
</html>
